namespace CarErp.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class CarPurchaseApplication : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.CarPurchaseApplication",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        ApplicantCompany = c.String(nullable: false, maxLength: 80, storeType: "nvarchar"),
                        ApplicantTime = c.DateTime(nullable: false, precision: 0),
                        CarName = c.String(nullable: false, maxLength: 40, storeType: "nvarchar"),
                        Brand = c.String(nullable: false, maxLength: 40, storeType: "nvarchar"),
                        Specification = c.String(nullable: false, maxLength: 40, storeType: "nvarchar"),
                        ModelNumber = c.String(nullable: false, maxLength: 40, storeType: "nvarchar"),
                        Maker = c.String(nullable: false, maxLength: 80, storeType: "nvarchar"),
                        Quantity = c.Int(nullable: false),
                        BudgetUnitPrice = c.Decimal(nullable: false, precision: 14, scale: 2),
                        PlannedAcquisitionDate = c.DateTime(nullable: false, precision: 0),
                        Appendix = c.String(nullable: false, maxLength: 400, storeType: "nvarchar"),
                        SourceOfFunds = c.String(nullable: false, maxLength: 40, storeType: "nvarchar"),
                        PropertyRight = c.Int(nullable: false),
                        Submitter_Id = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.User", t => t.Submitter_Id, cascadeDelete: true)
                .Index(t => t.Submitter_Id);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.CarPurchaseApplication", "Submitter_Id", "dbo.User");
            DropIndex("dbo.CarPurchaseApplication", new[] { "Submitter_Id" });
            DropTable("dbo.CarPurchaseApplication");
        }
    }
}
